
/// <summary>
/// 受击状态
/// </summary>
public class HitState : IState
{
    public HitState(FSM manager)
    {
        this.manager = manager;
        this.parameter = manager.parameter;
    }

    public override void OnEnter()
    {
        AudioManager.Instance.PlaySFX("人物受击");
        parameter.animator.SetTrigger("isHit");
    }
    public override  void OnUpdate()
    {
        //转换到死亡状态
        if (parameter.isDead)
        {
            manager.TransitionState(StateType.Death);
        }

        //动画播放95%切换到待机状态
        if (parameter.animatorStateInfo.normalizedTime >= .95f)
        {
            manager.TransitionState(StateType.Idle);
        }
    }
    public override  void OnFixedUpdate()
    {
        manager.Move();
    }

    public override  void OnExit()
    {
        parameter.isHurt = false;
    }
}
